var express = require('express');
var path = require('path');
var cookieParser = require('cookie-parser');
var logger = require('morgan');

var evaluationRouter = require('./routes/Evaluation');
// 作者：洪刚
// 内容：供应商详情、货品、购物车
var SupplierRouter = require('./routes/Supplier'); //供应商详情
var SupplierGoods = require('./routes/Suppliergoods'); //供应商货品
var Shopping = require('./routes/shopping'); //购物车
var goodsRouter = require('./routes/goods'); //商品
var serviceRouter = require('./routes/service.js'); //服务


var Salesstores = require('./routes/salesstores'); //所有门店


var app = express();
app.use(require("./cors"))

app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser("xzx"));
app.use(express.static(path.join(__dirname, 'public')));

// app.use(require("./permission"))
app.use(require("./cors"))

//段彦蓉
app.use("/api/petowners", require("./routes/Petowners"));
app.use("/api/order", require("./routes/Order"));

//向志祥
app.use('/api/user', require("./routes/users"))
app.use("/api/stores", require("./routes/stores"))

app.use('/api/eualuation', evaluationRouter);
// 作者：洪刚
// 内容：供应商详情、货品、购物车
app.use("/api/supplier", SupplierRouter);//供应商详情
app.use("/api/suppliergoods", SupplierGoods);//供应商货品
app.use("/api/shopping", Shopping);//购物车
app.use("/api/salesstores",Salesstores) //所有门店

app.use("/api/goods", goodsRouter);
app.use("/api/service", serviceRouter);

module.exports = app;
